<?php
require_once 'conn.inc.php';
if(empty($_GET['cid'])){
	die('AJAX请求参数不正确!');
}
	//$query = 'select gid,cid,gname,object,remark,path from groups where cid = ? and isshow = 1';
	$query = 'select a.*,b.ename from (select gid,cid,gname,object,remark,path from groups where cid = ? and isshow = 1) a left join class_all b on a.cid = b.id';
	try{
		$stmt = $link->prepare($query);
		$stmt->execute([$_GET['cid']]);
		$g_arr = $stmt->fetchAll(PDO::FETCH_ASSOC);
	}catch(PDOException $e){
		die('获取小组出错:'.$e->getMessage());
	}
	//print_r($g_arr);//OK
	
	$query = 'select id,cid,cuname,object,remark,path from users where cid = ? and isshow = \'1\'';
	try{
		$stmt = $link->prepare($query);
		$stmt->execute([$_GET['cid']]);
		$u_arr = $stmt->fetchAll(PDO::FETCH_ASSOC);
	}catch(PDOException $e){
		die('获取个人列表出错:'.$e->getMessage());
	}
	
	
	
	
	echo '<div id="list_main">
	<h3>小组项目</h3>
	<ul>';
	foreach($g_arr as $value){
		if($value['cid'] == 8){
			echo "<a target=\"_blank\" href=\"http://dxnds.net:8080/kp08b_{$value['path']}\"><li>{$value['gname']}:{$value['object']}</li></a>";
		}else{
		echo "<a target=\"_blank\" href=\"{$value['ename']}/{$value['path']}\"><li>{$value['gname']}:{$value['object']}</li></a>";
			
		}

	}
	echo '	</ul>
	<h3>个人项目</h3>
	<ul>';
	foreach($u_arr as $users){
		if($users['cid'] == 8){
			echo "<a target=\"_blank\" href=\"http://dxnds.net:8080/{$users['path']}\"><li>{$users['cuname']}</li></a>";
		}else{
		echo "<a target=\"_blank\" href=\"{$value['ename']}/{$users['path']}\"><li>{$users['cuname']}</li></a>";
			
		}

	}
	echo '	</ul>
</div>';
?>


<!--<div id="list_main">
	<h3>小组项目</h3>
	<ul>
		<li>第一组:音乐系统</li>
		<li>第二组:商城系统</li>
		<li>第三组:商城系统</li>
		<li>第四组:</li>
		<li>第五组:</li>
		<li>第六组:</li>
	</ul>
	<h3>个人项目</h3>
	<ul>
		<li>霍德明(邵)</li>
		<li>霍德明</li>
		<li>霍德明</li>
		<li>霍德明</li>
		<li>霍德明</li>
		<li>霍德明</li>
	</ul>
</div>-->